package cn.edu.ren.service.imp;

import cn.edu.ren.dao.ItemDao;
import cn.edu.ren.entity.Item;
import cn.edu.ren.service.ItemService01;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import org.springframework.data.domain.Pageable;
import java.util.List;

/**
 * @PackageName: cn.edu.ren.service.imp.imp
 * @ClassName: ItemService01Imp
 * @Description:
 * @author: RZS
 * @date: 2021/7/12  16:42
 */
@Service
public class ItemService01Imp implements ItemService01 {

    @Autowired
    private ItemDao itemDao;


    // 根据标题查询(不含分页)
    @Override
    public List<Item> findByTitle(String title) {
        return itemDao.findByTitle(title);
    }

    // 根据标题查询(含分页)
    @Override
    public List<Item> findByTitle(String title, Pageable pageable) {
        return itemDao.findByTitle(title, pageable);
    }

    // 根据匹配和分类进行查询
    @Override
    public List<Item> findByBrandAndCategory(String brand, String category) {
        return itemDao.findByBrandAndCategory(brand, category);
    }

    // 查询指定品牌名的数据或者小于指定价格的数据
    @Override
    public List<Item> findByBrandOrPriceLessThan(String brand, Double price) {
        return itemDao.findByBrandOrPriceLessThan(brand, price);
    }

    // 获取分类不是指定分类的数据(含分页)
    @Override
    public List<Item> findByCategoryNot(String category, Pageable pageable) {
        return itemDao.findByCategoryNot(category, pageable);
    }

    // 查询指定价格范围内的数据（含分页）
    @Override
    public List<Item> findByPriceBetween(Double arg0, Double arg1) {
        return itemDao.findByPriceBetween(arg0, arg1);
    }
}
